package com.info.zhiduoduo.admin.model.dto.kingdee;

import com.info.zhiduoduo.repository.dto.account.ReceivableDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class ExportReceivableDto {

	//序号---默认从100000自增
    private int serialNumber;
    //业务日期---项目开始日期
    private String businessDate;
    //是否期初单据---默认False
    private String whetherOpeningDocuments;
    //到期日---项目开始日期
    private String expireDate;
    //客户#编码---发布项目的企业编码
    private String customerCode;
    //客户#名称---发布项目的企业名称
    private String customerName;
    //币别#编码---默认PRE001
    private String currencyCode;
    //币别#名称---默认人民币
    private String currencyName;
    //价外税
    private String extraTax;
    //结算组织#编码---平台主体公司编码
    private String settlementOrganizationCode;
    //结算组织#名称---平台主体公司名称
    private String settlementOrganizationName;
    //销售组织#编码---平台主体公司编码
    private String saleOrganizationCode;
    //销售组织#名称---平台主体公司名称
    private String saleOrganizationName;
    //收款组织#编码---平台主体公司编码
    private String collectionOrganizationCode;
    //收款组织#名称---平台主体公司名称
    private String collectionOrganizationName;
    //按含税单价录入---默认为True
    private String whetherTaxIncluded;
    //销售员#编码---商务经理英文名称
    private String salespersonCode;
    //销售员#名称---商务经理中文名称
    private String salespersonName;
    //业务类型---默认标准应收
    private String businessType;
    //立账类型---默认业务应收
    private String openAnAccountType;
    //表头客户(序号)---默认从100000自增
    private int customerNumber;
    //订货方#编码---发布项目的企业编码
    private String orderingPartyCode;
    //订货方#名称---发布项目的企业名称
    private String orderingPartyName;
    //收货方#编码---发布项目的企业编码
    private String shipToCode;
    //收货方#名称---发布项目的企业名称
    private String shipToName;
    //付款方#编码---发布项目的企业编码
    private String payerCode;
    //付款方#名称---发布项目的企业名称
    private String payerName;
    //结算方式#编码---默认JSFS04_SYS
    private String settlementMethodCode;
    //结算方式#名称---默认电汇
    private String settlementMethodName;
    //汇率类型#编码---HLTX01_SYS
    private String exchangeRateType;
    //汇率类型#名称---固定汇率
    private String exchangeRateName;
    //汇率---默认1
    private int exchangeRate;
    //税额---项目税费
    private String taxAmount;
    //不含税金额---发布项目时的金额
    private String noTaxAmount;
    //明细(序号)---默认从100000自增
    private int detailedNumber;
    //物料编码#编码---默认001
    private String materielCode;
    //物料编码#名称---默认网站业务
    private String materielName;
    //物料说明#中文(简体/中国)---默认网站业务
    private String materielExplain;
    //计价单位#编码---默认Pcs
    private String valuationCode;
    //计价单位#名称---默认Pcs
    private String valuationName;
    //计价数量---默认为1
    private int valuationNumber;
    //含税单价---项目成交金额[项目金额+税费]
    private String unitPrice;
    //不含税单价---项目金额
    private String noUnitPrice;
    //税率(%)---项目基础服务费率
    private double taxRate;
    //价税合计---项目成交金额[项目金额+税费]
    private String total;

    //单据编号---默认为空
    private String billNumber;
    //备注---默认为空
    private String remarks;
    //间隔列---默认为空
    private String intervalRows;

    public static ExportReceivableDto of(int number, String date, String projectTaxAmount,
                                         String projectAmount, String transactionAmount,
                                         ReceivableDto dto){
        return new ExportReceivableDto()
                .setSerialNumber(number)
                .setBusinessDate(date)
                .setWhetherOpeningDocuments("False")
                .setExpireDate(date)
                .setCustomerCode(dto.getReleaseCompanyCode())
                .setCustomerName(dto.getReleaseCompanyName())
                .setCurrencyCode("PRE001")
                .setCurrencyName("人民币")
                .setExtraTax("FALSE")
                .setSettlementOrganizationCode(dto.getSubjectCompanyOrganizationCode())
                .setSettlementOrganizationName(dto.getSubjectCompanyName())
                .setSaleOrganizationCode(dto.getSubjectCompanyOrganizationCode())
                .setSaleOrganizationName(dto.getSubjectCompanyName())
                .setCollectionOrganizationCode(dto.getSubjectCompanyOrganizationCode())
                .setCollectionOrganizationName(dto.getSubjectCompanyName())
                .setWhetherTaxIncluded("True")
                .setSalespersonCode(dto.getBusinessManagerCode())
                .setSalespersonName(dto.getBusinessManagerCode())
                .setBusinessType("标准应收")
                .setOpenAnAccountType("业务应收")
                .setCustomerNumber(number)
                .setOrderingPartyCode(dto.getReleaseCompanyCode())
                .setOrderingPartyName(dto.getReleaseCompanyName())
                .setShipToCode(dto.getReleaseCompanyCode())
                .setShipToName(dto.getReleaseCompanyName())
                .setPayerCode(dto.getReleaseCompanyCode())
                .setPayerName(dto.getReleaseCompanyName())
                .setTaxAmount(projectTaxAmount)
                .setNoTaxAmount(projectAmount)
                .setDetailedNumber(number)
                .setMaterielCode( dto.getMaterielCode())
                .setMaterielName("网站业务")
                .setMaterielExplain("网站业务")
                .setValuationCode("Pcs")
                .setValuationName("Pcs")
                .setValuationNumber(1)
                .setUnitPrice(transactionAmount)
                .setNoUnitPrice(projectAmount)
                .setTaxRate(dto.getProjectBaseServiceRate())
                .setTotal(transactionAmount)
                .setSettlementMethodCode("JSFS04_SYS")
                .setSettlementMethodName("电汇")
                .setExchangeRateType("HLTX01_SYS")
                .setExchangeRateName("固定汇率")
                .setExchangeRate(1)

                .setBillNumber("").setRemarks("").setIntervalRows("");
    }
}
